<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = [];
        function fn(a, b) {
            if (a < b) {
                for (var i = a; i <= b; i++) {
                    if (i % 2 == 0) {
                        arr.push(i)
                        // console.log(arr)

                    }
                }
            }
            else if (b < a) {
                for (var i = b; i <= a; i++) {
                    if (i % 2 == 0) {
                        arr.push(i)
                    }
                }
            }
            console.log(arr)
        }
        fn(10, 200)

    </script>
</body>

</html>